package proxyTest.Dyna;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zyc
 * @create 2022--05--06 11:41
 */
public class MesInvocationHandler implements InvocationHandler {
    //代理对象
    private final Object target;

    public MesInvocationHandler(Object target) {
        this.target = target;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        String a = "【调用代理对象前的方法】";
        String b = "[调用代理对象后的方法]";
        Object result = a + method.invoke(target, args) + b;
        return result;
    }
}
